﻿https://docs.gradle.org/current/userguide/performance.html#increase_heap_size

8. Increase the Heap Size
By default, Gradle reserves 512MB of heap space for your build, which is sufficient for most projects.

However, very large builds may require more memory to store Gradle’s model and caches. If needed, you can increase the heap size by specifying the following property in the gradle.properties file in your project root or your Gradle home directory:

gradle.properties
org.gradle.jvmargs=-Xmx2048M
 
For more details, see the JVM Memory Configuration documentation.
